package account.bean;

import java.util.ArrayList;

import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.faces.bean.ManagedBean;
import account.command.CommandException;
import account.command.GetAccountsCommand;
import account.model.AccountModel;

@ManagedBean(name="accountList")
@RequestScoped
public class AccountBean {
		
	private ArrayList< AccountModel> accounts = null;
	
	@PostConstruct
	public void create() {
		GetAccountsCommand getAccounts = new GetAccountsCommand();
		try {
			getAccounts.execute();
			accounts = getAccounts.outAccountModels;
		} catch (CommandException e) {
			accounts = null;
		}
	}

	public ArrayList<AccountModel> getAccounts() {
		return accounts;
	}

	public void setAccounts(ArrayList<AccountModel> accounts) {
		this.accounts = accounts;
	}

	public String action()
	{
		return null;
	}
	
	public String newAccount() {
		return null;
	}
		
	
}
